

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>speechemotionrecognition.utilities module &mdash; Speech Emotion Recognition 1.0 documentation</title>
  

  
  
  
  

  
  <script type="text/javascript" src="_static/js/modernizr.min.js"></script>
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
        <script type="text/javascript" src="_static/jquery.js"></script>
        <script type="text/javascript" src="_static/underscore.js"></script>
        <script type="text/javascript" src="_static/doctools.js"></script>
        <script type="text/javascript" src="_static/language_data.js"></script>
    
    <script type="text/javascript" src="_static/js/theme.js"></script>

    

  
  <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="prev" title="speechemotionrecognition.mlmodel module" href="speechemotionrecognition.mlmodel.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="main.html" class="icon icon-home"> Speech Emotion Recognition
          

          
          </a>

          
            
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <p class="caption"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="modules.html">speechemotionrecognition</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="speechemotionrecognition.html">speechemotionrecognition package</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="speechemotionrecognition.html#submodules">Submodules</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="speechemotionrecognition.dnn.html">speechemotionrecognition.dnn module</a></li>
<li class="toctree-l4"><a class="reference internal" href="speechemotionrecognition.mlmodel.html">speechemotionrecognition.mlmodel module</a></li>
<li class="toctree-l4 current"><a class="current reference internal" href="#">speechemotionrecognition.utilities module</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="speechemotionrecognition.html#module-speechemotionrecognition">Module contents</a></li>
</ul>
</li>
</ul>
</li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="main.html">Speech Emotion Recognition</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="main.html">Docs</a> &raquo;</li>
        
          <li><a href="modules.html">speechemotionrecognition</a> &raquo;</li>
        
          <li><a href="speechemotionrecognition.html">speechemotionrecognition package</a> &raquo;</li>
        
      <li>speechemotionrecognition.utilities module</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="_sources/speechemotionrecognition.utilities.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="module-speechemotionrecognition.utilities">
<span id="speechemotionrecognition-utilities-module"></span><h1>speechemotionrecognition.utilities module<a class="headerlink" href="#module-speechemotionrecognition.utilities" title="Permalink to this headline">¶</a></h1>
<p>author: harry-7</p>
<p>This file contains functions to read the data files from the given folders and
generate Mel Frequency Cepestral Coefficients features for the given audio
files as training samples.</p>
<dl class="function">
<dt id="speechemotionrecognition.utilities.get_data">
<code class="descclassname">speechemotionrecognition.utilities.</code><code class="descname">get_data</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/speechemotionrecognition/utilities.html#get_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#speechemotionrecognition.utilities.get_data" title="Permalink to this definition">¶</a></dt>
<dd><p>Extract data for training and testing.</p>
<ol class="arabic simple">
<li>Iterate through all the folders.</li>
<li>Read the audio files in each folder.</li>
<li>Extract Mel frequency cepestral coefficients for each file.</li>
<li>Generate feature vector for the audio files as required.</li>
</ol>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>data_path</strong> (<em>str</em>) – path to the data set folder</li>
<li><strong>flatten</strong> (<em>bool</em>) – Boolean specifying whether to flatten the data or not.</li>
<li><strong>mfcc_len</strong> (<em>int</em>) – Number of mfcc features to take for each frame.</li>
<li><strong>class_labels</strong> (<em>tuple</em>) – class labels that we care about.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Two numpy arrays, one with mfcc and
other with labels.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">Tuple[numpy.ndarray, numpy.ndarray]</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="speechemotionrecognition.utilities.get_feature_vector_from_mfcc">
<code class="descclassname">speechemotionrecognition.utilities.</code><code class="descname">get_feature_vector_from_mfcc</code><span class="sig-paren">(</span><em>file_path: str</em>, <em>flatten: bool</em>, <em>mfcc_len: int = 39</em><span class="sig-paren">)</span> &#x2192; numpy.ndarray<a class="reference internal" href="_modules/speechemotionrecognition/utilities.html#get_feature_vector_from_mfcc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#speechemotionrecognition.utilities.get_feature_vector_from_mfcc" title="Permalink to this definition">¶</a></dt>
<dd><p>Make feature vector from MFCC for the given wav file.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>file_path</strong> (<em>str</em>) – path to the .wav file that needs to be read.</li>
<li><strong>flatten</strong> (<em>bool</em>) – Boolean indicating whether to flatten mfcc obtained.</li>
<li><strong>mfcc_len</strong> (<em>int</em>) – Number of cepestral co efficients to be consider.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">feature vector of the wav file made from mfcc.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">numpy.ndarray</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>


           </div>
           
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
      
        <a href="speechemotionrecognition.mlmodel.html" class="btn btn-neutral float-left" title="speechemotionrecognition.mlmodel module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2019, Hemanth Kumar Veeranki

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>